Page({
  data: {
    settings: {
      showChineseSentence: true,
      playEnglishSentence: false,
      playChineseSentence: false
    }
  },

  onLoad() {
    // 加载本地存储的设置
    const settings = wx.getStorageSync('settings');
    if (settings) {
      this.setData({
        settings: {...this.data.settings, ...settings}
      });
    }
  },

  toggleShowChineseSentence(e) {
    const settings = this.data.settings;
    settings.showChineseSentence = e.detail.value;
    this.updateSettings(settings);
  },

  togglePlayEnglishSentence(e) {
    const settings = this.data.settings;
    settings.playEnglishSentence = e.detail.value;
    this.updateSettings(settings);
  },

  togglePlayChineseSentence(e) {
    const settings = this.data.settings;
    settings.playChineseSentence = e.detail.value;
    this.updateSettings(settings);
  },

  updateSettings(settings) {
    this.setData({ settings });
    wx.setStorageSync('settings', settings);
  }
}); 